home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1083 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.2 KB

  1. From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
  2. Message-ID: <4kqua6$3sv@mulga.cs.mu.OZ.AU>
  3. X-Original-Date: 14 Apr 1996 13:24:22 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 15 Apr 96 07:18:50 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Use of standard exception classes
  9. Organization: Comp Sci, University of Melbourne
  10. References: <9604121530.AA08606@sun132.spd.dsccc.com>
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMXH4feEDnX0m9pzZAQFLngGAmXlyQnfjuHRGGaj532TqcO+45egrpZU2
  13.     TsJLcRgrWCvXagfyTdziepdyWKow5Qeg
  14.     =ME1R
  15.  
  16. kcline@spdmail.spd.dsccc.com (Kevin Cline) writes:
  17.  
  18. >In "The Standard C++ Library" on page 65, Plauger wrote:
  19. >
  20. >  "I strongly encourage you to follow the lead of the Standard C++
  21. >   library in the use of exceptions:
  22. >   * Throw only objects of one or more classes derived from [exception]
  23. >
  24. >Page 19-1 of the 4/95 version of the draft says "The Standard C++
  25. >library provides classes to be used to report errors in C++ programs."
  26. >
  27. >But in section 19.1.1 of the same draft it says:
  28. >
  29. >"The class exception defines the base class for the  types  of  objects
  30. > thrown  as  exceptions by *C++ Standard library components*, and certain
  31. > expressions, to report errors detected during program execution."
  32.  
  33. Section 19.1/1 (that is, section 19.1 paragraph 1) of the Jan 96 draft
  34. states it more clearly:
  35.  
  36. |   19.1  Exception classes                           [lib.std.exceptions]
  37. | 1 The Standard C++ library provides classes to be used to report certain
  38. |   errors (_lib.res.on.exception.handling_)  in  C++  programs.
  39.  
  40. Note that section 19.1.1 is
  41.  
  42. |  19.1.1  Class logic_error                            [lib.logic.error]
  43.  
  44. which is probably not the section to which you were referring.  I find
  45. it helpful to use `.' for sub-section numbers and `/' for paragraph
  46. numbers, to avoid confusion.
  47.  
  48. >Can someone on the committee indicate whether it was the committee's
  49. >intention for the standard exception class hierarchy to be used in
  50. >general C++ programming, or whether the intention was for the standard
  51. >exception class hierarchy to be reserved to the Standard C++ library?
  52.  
  53. I believe the emphasis on "by *C++ Standard library components*" was
  54. simply intended to stress the point that other C++ code didn't have
  55. to throw only objects derived from class `exception' (as I believe was
  56. mooted in some previous designs for C++ exception handling).
  57. It was not intended to suggest that user's C++ code could not do so,
  58. only that they did not have to do so.  I guess this wording was
  59. recognized as being confusing, since it has now been replaced.
  60.  
  61. I would still consider Plauger's advice quoted above as good advice.
  62.  
  63. --
  64. Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
  65. WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
  66. PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
  67. ---
  68. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  69. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  70. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  71. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  72. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  73.